package com.qt.map;

import com.qt.map.entity.Student;

import java.util.TreeMap;

public class TreeMapDemo {
    public static void main(String[] args) {
        TreeMap<Student, String> treeMap = new TreeMap<>();

        Student student1 = new Student("张三", 18);
        Student student2 = new Student("李四", 20);
        Student student3 = new Student("王五", 19);

        treeMap.put(student1, "湖南");
        treeMap.put(student2, "陕西");
        treeMap.put(student3, "广东");

        treeMap.forEach((key,value)-> System.out.println("key:"+key+" value:"+value));


    }
}
